Serveur Echo

#include "servLib.h" /******************************************************************************* Point d'entrée. Lance le serveur sur le port TCP 4404, pour 32 clients maximum. *******************************************************************************/ int main () { cbx_Serveur_Start(4404, 32); return 0; } /******************************************************************************* Un nouveau client a été accepté *******************************************************************************/ void onAccept (int idRequest, SOCKET i) { printf ("Socket %d accepté\n", i); } /******************************************************************************* Des données arrivent. Renvoie la chaîne au client. *******************************************************************************/ void onData_Arrival (SOCKET i, char *buf, short nbytes) { printf("Le client %d me dit: %s\n", i, buf); if (send(i, buf, nbytes, 0) == -1) perror("send()"); } /******************************************************************************* Un client quitte. *******************************************************************************/ void onClient_Left (SOCKET i) { printf("Le socket %d vient de fermer sa connection\n", i); } /******************************************************************************* Survient en cas d' erreur inopinée *******************************************************************************/ void onError (SOCKET i, char *errmsg) { printf("%s\n", errmsg); }